<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>南流景</title>
    <link rel="stylesheet" href="{% static 'layui/css/layui.css' %}">
    <script src="{% static 'layui/layui.js' %}"></script>
    <link rel="stylesheet" href="{% static 'kindeditor/themes/qq/qq.css' %}">
    <link rel="stylesheet" href="{% static 'kindeditor/plugins/code/prettify.css' %}">
    <script charset="utf-8" src="{% static 'kindeditor/kindeditor-all-min.js' %}"></script>
    <script charset="utf-8" src="{% static 'kindeditor/lang/zh-CN.js' %}"></script>
    <script charset="utf-8" src="{% static 'kindeditor/plugins/code/prettify.js' %}"></script>
</head>
<body>
<div class="layui-row">
    <div class="layui-col-md10" >
    <form class="layui-form layui-form-pane" action="{% url 'user:user_updateessay' %}" method="post">
    {% csrf_token %}
    <input type="hidden" name="essayid" value="{{ essayid }}">
        <div class="layui-form-item">
            <label class="layui-form-label">标题</label>
            <div class="layui-input-block">
                <input type="text" name="title" autocomplete="off" value="{{ title }}" placeholder="请输入标题" lay-verify="required"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-inline">
                <select name="typeid" lay-filter="aihao">
                    {% for item in typedb %}
                          <option value="{{ item.typeid }}" {% if typeid == item.typeid %} selected {% endif %} >{{ item.type }}</option>
                    {% endfor %}
                </select>
            </div>
        </div>
        <div class="layui-form-item layui-form-text">
            <label class="layui-form-label" style="text-align: center">博文</label>
            <div class="layui-input-block">
        <textarea id="content" name="content" placeholder="请输入内容"  class="layui-textarea" style="height: 400px">
            {{ content }}
        </textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <input type="text" id="remark" name="remark" value="{{remark}}" autocomplete="off" placeholder="请输入"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item" style="text-align: center">
            <button class="layui-btn" lay-submit lay-filter="demo2">确认</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </form>
    </div>
</div>
</body>
<script>
    KindEditor.ready(function (K) {
        var csrfToken = document.getElementById('csrfmiddlewaretoken').value;
        editor = K.create('textarea[name="content"]', {
            allowFileManager: true,
            uploadJson: '/user/alltypeimg',
            filePostName: 'imgFile',
            extraFileUploadParams: {
                csrfmiddlewaretoken:csrfToken
            },
        });
    });
</script>
</html>